###
 # @Description: 
 # @Version: 2.0
 # @Autor: gang
 # @Date: 2020-09-17 17:30:23
 # @LastEditors: gang
 # @LastEditTime: 2020-10-22 13:20:12
 # 0    0    24    *    *    /usr/bin/curl -X POST -H "flag:tm"  "http://txxxxxulcampaign.com/csv/outdata"  > /dev/null
### 
#!/bin/bash
#生成csv数据
gender=`/usr/bin/curl  -X POST -H "flag:xx"  "http://xxxx.com/csv/outdata"`
#ftp地址
SFTP_ADDR=sftp://xxxx.unilever-china.com:22
#用户名
USER="usrname"
#密码
PASSWORD="pwd"
#待上传文件根目录
CLIENTDIR=/home/outcsv
#SFTP目录 /u_jfgj/DailyFiles
SEVERDIR=/home
#待上传文件名
FILENAME=$(date -d "yesterday" +%Y%m%d).csv

[ $gender -eq 1 ] && {
lftp -u ${USER},${PASSWORD} ${SFTP_ADDR} <<EOF
cd ${SEVERDIR}/
lcd ${CLIENTDIR}
put ${FILENAME}
by
EOF
}
